import request from '@/utils/request'

// 查询院校列表
export function listCollege(query) {
  return request({
    url: '/system/college/list',
    method: 'get',
    params: query
  })
} 

// 查询院校详细
export function getCollege(collegeId) {
  return request({
    url: '/system/college/' + collegeId,
    method: 'get'
  })
}


// 查询校管理员
export function getStaff(collegeId) {
  return request({
    url: '/system/college/staffList?id=' + collegeId,
    method: 'get'
  })
}

// 新增院校
export function addCollege(data) {
  return request({
    url: '/system/college',
    method: 'post',
    data: data
  })
}

// 修改院校
export function updateCollege(data) {
  return request({
    url: '/system/college',
    method: 'put',
    data: data
  })
}

// 删除院校
export function delCollege(collegeId) {
  return request({
    url: '/system/college/' + collegeId,
    method: 'delete'
  })
}

// 导出院校
export function exportCollege(query) {
  return request({
    url: '/system/college/export',
    method: 'get',
    params: query
  })
}

// 下载用户导入模板
export function importTemplate() {
  return request({
    url: '/system/college/importTemplate',
    method: 'get'
  })
}


// 查询院校列表数量
export function getSchoolList() {
  return request({
    url: '/system/college/getSchoolList',
    method: 'get',
  })
}

// 查询学生数量
export function getStudentList() {
  return request({
    url: '/system/college/getStudentList',
    method: 'get',
  })
}

// 查询学生学习数量
export function getStudyList() {
  return request({
    url: '/system/college/getStudyList',
    method: 'get',
  })
}

// 课程累计学习次数
export function getSumStudyNum() {
  return request({
    url: '/system/college/getSumStudyNum',
    method: 'get',
  })
}


// 今日学习次数
export function getSumDayStudyNum() {
  return request({
    url: '/system/college/getSumDayStudyNum',
    method: 'get',
  })
}

//调用百度api
export function MP(ak) {  
  return new Promise(function (resolve, reject) {  
    window.onload = function () {  
      resolve(BMap)  
    }  
    var script = document.createElement("script");  
    script.type = "text/javascript";  
    script.src = "http://api.map.baidu.com/api?v=2.0&ak="+ak+"&callback=init";  
    script.onerror = reject;  
    document.head.appendChild(script);  
  })  
}  

